import '../css/index.css'

const app = new Vue({
    el:'#app',
    data(){
        return {
            list:[
                {
                    id:1,
                    imgUrl:"./img/0.jpg",
                    text:"小米11 Ultra,开启影像新时代",
                    price:5999
                },
                {
                    id:2,
                    imgUrl:"./img/2.jpg",
                    text:"智能定时|用电统计|过载保护",
                    price:49
                },
                {
                    id:3,
                    imgUrl:"./img/3.jpg",
                    text:"小身材也有大智慧",
                    price:49
                },
                {
                    id:4,
                    imgUrl:"./img/4.jpg",
                    text:"RedMi Note 9 4G 6000MA大电量",
                    price:999
                },
                {
                    id:5,
                    imgUrl:"./img/5.jpg",
                    text:"青年‘无须’新选择",
                    price:99
                },
                {
                    id:6,
                    imgUrl:"./img/6.jpg",
                    text:"全面屏更多可能",
                    price:229
                },
                {
                    id:7,
                    imgUrl:"./img/7.jpg",
                    text:"5号彩虹电池(10粒),无汞无锡",
                    price:9.9
                },
                {
                    id:8,
                    imgUrl:"./img/1.jpg",
                    text:"小米插线板 5孔位,过载断电保护",
                    price:39
                },
            ],
            msg:null
        }
    },
    methods:{
        changeIdData(val){
            if(val === 1){
                this.msg = '第一个内容'
            }else if(val === 2){
                this.msg = '第二个内容'
            }else if(val === 3){
                this.msg = '第三个内容'
            }else if(val === 4){
                this.msg = '第四个内容'
            }else if(val === 5){
                this.msg = '第五个内容'
            }else if(val === 6){
                this.msg = '第六个内容'
            }else if(val === 7){
                this.msg = '第七个内容'
            }else{
                this.msg = '第八个内容'
            }
        }
    },
    components:{
        'my-cpn':{
            template:'#myCpn',
            props:['listdata'],
            data(){
                return {

                }
            },
            methods:{
                clickCpn(){
                    this.$emit('changeid',this.listdata.id)
                }
            },
            filters:{
                newPrice(val){
                    return '¥' + val.toFixed(2)
                }
            }
        }
    }
})

